//(function(d){
//    var js, id = 'facebook-jssdk', ref = d.getElementsByTagName('script')[0];
//    if (d.getElementById(id)) {return;}
//    js = d.createElement('script'); js.id = id; js.async = true;
//    js.src = "//connect.facebook.net/en_US/all.js";
//    ref.parentNode.insertBefore(js, ref);
//  }(document));  

//window.fbAsyncInit = function() {
//        FB.init({
//          appId      : '370328526354985', // App ID
//          channelUrl : '//'+window.location.hostname+'/channel', // Path to your Channel File
//          status     : true, // check login status
//          cookie     : true, // enable cookies to allow the server to access the session
//          xfbml      : true  // parse XFBML
//        });
//
//        // listen for and handle auth.statusChange events
//        FB.Event.subscribe('auth.statusChange', function(response) {
//          if (response.authResponse) {
//            // user has auth'd your app and is logged into Facebook
//            FB.api('/me', function(me){
//              if (me.name) {
//                document.getElementById('auth-displayname').innerHTML = me.name;
//              } }
//            )
//            
//           			  
//            document.getElementById('auth-loggedout').style.display = 'none';
//            document.getElementById('auth-loggedin').style.display = 'block';
//            document.getElementById('page').style.display = 'block';
//            document.getElementById('auth-like').style.display = 'block';
//          } else {
//            // user has not auth'd your app, or is not logged into Facebook
//            
//                        
//            document.getElementById('auth-loggedout').style.display = 'block';
//            document.getElementById('auth-loggedin').style.display = 'none';
//            document.getElementById('page').style.display = 'none';
//            document.getElementById('auth-like').style.display = 'none';
//          }
//        });
//
//        // respond to clicks on the login and logout links
//        document.getElementById('auth-loginlink').addEventListener('click', function(){
//          FB.login();
//        });
//        document.getElementById('auth-logoutlink').addEventListener('click', function(){
//          FB.logout();
//        }); 
//      } 
//
//  
  

(function(d, s, id) {
				  var js, fjs = d.getElementsByTagName(s)[0];
				  if (d.getElementById(id)) return;
				  js = d.createElement(s); js.id = id;
				  js.src = "//connect.facebook.net/es_LA/all.js#xfbml=1&appId=315132428583493";
				  fjs.parentNode.insertBefore(js, fjs);
				}(document, 'script', 'facebook-jssdk'));







var profilePicsDiv = document.getElementById('profile_pics');
FB.getLoginStatus(function(response) {
  if (response.status != 'connected') {
    profilePicsDiv.innerHTML = '<em>You are not connected</em>';
    return;
  }

  FB.api({ method: 'friends.get' }, function(result) {
    Log.info('friends.get response', result);
    var markup = '';
    var numFriends = result ? Math.min( result.length) : 0;
    if (numFriends > 0) {

      for (var i=0; i<numFriends; i++) {

        markup += (
          '<fb:profile-pic size="square" ' +
                          'uid="' + result[i] + '" ' +
                          'facebook-logo="false"' +
          '></fb:profile-pic></td><td>'
         // +'<fb:name uid=" ' + result[i] + ' " use-you="no"></fb:name>'
        );
      }
     
    
    }
    profilePicsDiv.innerHTML = markup;
    FB.XFBML.parse(profilePicsDiv);
  });
});